<?php

include_once '../../Core/Conexion.php';
include_once '../../Core/ControladorSet.php';
include_once '../../Core/InterfazDatos.php';
///****
include_once '../entidades/Curso.php';
include_once '../entidades/Institucion.php';
include_once '../entidades/Periodo.php';
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of editar
 *
 * @author cHr15t14n
 */
class editar extends ControladorSet {

    public function buscarValores() {
        $tabla = "";
        $entidad = new Curso($_GET['codigo'],"","","","");
        $consulta = $this->conexion->consultaTabla($entidad);

        $fila = mysql_fetch_array($consulta);
        do {
            $this->diccionario['codigo'] = $fila[0];
            $this->diccionario['nombre'] = $fila[2];
            $this->diccionario['nivel'] = $fila[3];
            $this->diccionario['promedio'] = $fila[4];
            $options = "";
            $entidad1 = new Institucion("","","","","","","","");
            $consulta1 = $this->conexion->consultaTabla($entidad1);
            $fila1 = mysql_fetch_array($consulta1);
            do {
                if ($fila1[0] == $fila[1]) {
                    $options = $options . "<option value='" . $fila1[0] . "'selected='selected'>" . $fila1[2] . "</option>";
                } else {
                    $options = $options . "<option value='" . $fila1[0] . "'>" . $fila1[2] . "</option>";
                }
            } while ($fila1 = mysql_fetch_array($consulta1));
            $this->diccionario['nombreInstitucion'] = $options;
            
        } while ($fila = mysql_fetch_array($consulta));
    }

    public function setDiccionario() {
        $this->diccionario = array(
            "codigo" => "vacio",
            "nombreInstitucion" => "vacio",
            "nombre" => "vacio",
            "nivel" => "vacio",
            "promedio" => "vacio"
        );
    }

    public function setValorSesion() {
        $this->valorSesion = array("admin", "", "");
    }

//put your code here
}

$controlador = new editar('editarVista.php');
$controlador->rederizarPagina();

